<?php
namespace App\Modules\Relationship\Enums;

class ErrorEnum
{
    const COUPLE_ALREADY_EXISTS = 100;
    const COUPLE_ONE_DAY_EXISTS_REQ = 101;
    const SWEET_FRIENDS_POSITION_FULL = 102;
    const SWEET_FRIENDS_BUY_SUCCESS = 103;
    const FRIEND_RECORD_NO_EXISTS = 104;
    const SWEET_ALREADY_EXISTS = 105;
    const INTIMATE_NO_ENOUGH = 106;
    const COUPLE_REQ_NO_OVERDAY = 107;
    const SWEET_REQ_NO_OVERDAY = 108;
    const SWEET_POSITION_CARD_ERROR = 109;
    const SWEET_RELATION_ERROR = 110;
    const PROMOTED_VERSION_NOTICE = 111;
    const FRIEND_PROMOTED_VERSION_NOTICE = 112;
    const COUPLE_RELATION_ERROR = 113;
    const KEEPSSAKE_LEVEL_ERROR = 114;
    const COUPLE_KEEPSSAKE_REQ_ERROR = 115;

    static $Msg = [
        self::COUPLE_ALREADY_EXISTS => '您当前已有CP，不能结交新CP唷！',
        self::COUPLE_ONE_DAY_EXISTS_REQ => '24小时内只能申请一次唷~',
        self::SWEET_FRIENDS_POSITION_FULL=>'您的密友数量已满，购买扩展卡解锁更多密友位~',
        self::SWEET_FRIENDS_BUY_SUCCESS=>'购买成功，可以发起密友邀请啦~',
        self::FRIEND_RECORD_NO_EXISTS=>'您和对方还不是好友',
        self::SWEET_ALREADY_EXISTS=>'您与对方已经是密友啦，无法绑定CP',
        self::INTIMATE_NO_ENOUGH => '好友亲密度未达到1000',
        self::COUPLE_REQ_NO_OVERDAY => '邀请已过期，需要重新发起邀请唷~',
        self::SWEET_REQ_NO_OVERDAY => '邀请已过期，需要重新发起邀请唷~',
        self::SWEET_POSITION_CARD_ERROR=>'购买密友扩展位置出错',
        self::SWEET_RELATION_ERROR=>'好友关系已变更，退出刷新一下吧~',
        self::PROMOTED_VERSION_NOTICE=>'请更新至v2.4.0以上版本后再试试哦~',//请更新至v2.4.0版本~
        self::FRIEND_PROMOTED_VERSION_NOTICE=>'对方版本过低，暂不支持，快邀请对方升级吧~',
        self::COUPLE_RELATION_ERROR=>'好友关系已变更，退出刷新一下吧~',
        self::KEEPSSAKE_LEVEL_ERROR=>'信物已升级到更高等级，退出刷新一下吧~',
        self::COUPLE_KEEPSSAKE_REQ_ERROR=>'邀请已过期，请更新版本后重新发起~',
    ];

    /**
     * @param code
     * @param msg
     * @param join 默认false 参数拼接 true：codeMsg + msg
     * @param orderBy 默认false 参数顺序拼接倒换  true：msg + codeMsg
     * */
    static function getErrCodeMsg($code, $msg = '', $join = false, $orderBy = false)
    {
        if ($orderBy and $join and !empty($msg)) {
            return $msg . self::$Msg[$code];
        }

        if ($join and !empty($msg)) {
            return self::$Msg[$code] . '：' . $msg;
        }

        if (!empty($msg)) {
            return $msg;
        }

        return self::$Msg[$code]??'发生错误';
    }


}